﻿<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/demo/demo.css">
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/coun.css"/>
	<script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/template.js"></script>
	<script type="text/javascript" src="<%=path%>/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="<%=path%>/js/plugins/jquery.datagrid.js"></script>
<style>
	#div1{

		float: left;
		margin-left: 96px;
		
	}	
		#div2{
		margin-left: 40px;
		float: left;
	
	}	

        .subtotal { font-weight: bold; }/*合计单元格样式*/
  	.accountbox{
		width:1200px;
	}
		.titbtn{
		width:550px;
	}	
</style>
	<script type="text/javascript">

		function chaxv(){
			
			var riqi = $('#riqis').datebox('getValue'); 
			$('#tt').datagrid('reload',{
				"cropid":<%=session.getAttribute("cropid")%>,
				"riqi":riqi
			});
		}
	
  	function hidebtn(){
  		
  		$(".accountbox").hide();
  	}
		$(function(){
				
			 var datagrid; //定义全局变量datagrid
		     var editRow = undefined; //定义全局变量：当前编辑的行	
		     datagrid=$('#tt').datagrid({
				width:1000,
				height:370,
				showFooter:true,
				url:'<%=path%>/main/get/pros3',
				queryParams : {
     				 "cropid":<%=session.getAttribute("cropid")%>,
     				 "riqi":$('#riqis').datebox('getValue')
				},
			    selectOnCheck: true,
			    singleSelect:true,
				checkOnSelect: true,
		        pagination : true,		    
		        loadMsg: '数据加载中...',
			    mode : 'remote',
			    delay : 500,
			    rownumbers:true,
			    checkbox:true,
		        fit:false,
		        beforePageText: '第',//页数文本框前显示的汉字  
		        afterPageText: '页    共 {pages} 页',  
		        displayMsg: '共 {total} 条记录',
				title:'',
				  toolbar: [
				              
			                { text: '查看', iconCls: 'icon-edit', handler: function () {
			                	
			                	var das ="";
			               		var row = $('#tt').datagrid('getSelected');
			               		
			               		$(".accountbox").css("display","block");
			               	
			               		
			              		var lsh =row.serialno;
			              		var cropid=<%=session.getAttribute("cropid")%>
			              		
			              		
			              	  $.ajax({
			        	           type: "GET",
			        	           url:'<%=path%>/main/get/skxbs',
			        			   data : {
			        						 "cropid":cropid,
			        						 "serialno":lsh
			        					},
			        						async : false,
			        						success : function(data) {
			        							var data = eval('(' + data + ')');
			        						    var num = data.status;
			        						    if (num == 0) {
			        								    das=data.data;
			        								    
			        								    $("#dd").val(das.date);
			        								    $("#danju").val(das.no);
			        								    $("#lsh").val(das.serialno);
			        								    $("#djs").val(das.djsum);
			        								    $("#fph").val(das.invoiceno);
			        								    $("#gkxm").val(das.customer);
			        								    $("#sjh").val(das.telno);
			        								    $("#bksj").val(das.cardtime);
			        								    $("#yhhd").val(das.billmaincol3);
			        								
			        								    $("#yyjsj").val(das.reservatime);
			        								    $("#ckd").val(das.outboundorder);
			        							/* 	   if(das.outboundorder=="有"){
			        								   $("#ckd").find("option[value='1']").attr("selected", true);
			        								   }
			        								   if(das.outboundorder=="无"){
			        									   $("#ckd").find("option[value='0']").attr("selected", true);
			        									   } */
			        								   $("#fptt").val(das.invoicehead);
			        						     
			        							}else{
			        								$.messager.alert("","查询失败");
			        							}

			        						}
			        					}); 
			              	  
			              	  
			              	  
			              	$.extend($.fn.validatebox.defaults.rules, {    
			        			length: { validator: function (value, param) {
			        				
			        			if(value<=1){
			        				if((value + '').indexOf('.') != -1){
			        	            	   var len = $.trim(value).length;
			        		               return len >= param[0] && len <= param[1];
			        	            	}
			        				}
			                    },
			                        message: "格式错误，请输入正确的折扣率"
			                    }
			        		});  


			        		
			        		var ds =[
			        	{

			        	"ystype": "1",
			        	"ysname": "应收"
			        	},
			        	{
			        		"ystype": "0",
			        		"ysname": "应付"
			        	}
			        	];
			        		
			        		var as="";
			        		var xiaofeishuju ="";
			        		
			        			$.ajax({
			        				type:"GET",
			        		 		async: false,
			        				url:'<%=path%>/main/get/subinfo',
			        				dateType:'json',
			        				data:null,
			        				success:function(data){
			        					var result = eval('(' + data + ')');
			        					as=result.data;
			        				
			        					}
			        				});
			        			
			        			$.ajax({
			        				type:"GET",
			        		    	async: false,
			        		   	 	url:"<%=path %>/main/get/localxiaofei",
			        		   		data :{"cropid":<%=session.getAttribute("cropid")%>},
			        		   		dataType: "json",
			        		    	success:function(data){
			        		    						    		
			        		    		xiaofeishuju = data.data;		    		
			        			    	
			        		    	}
			        			});
			        			

			        		$('#ttt').datagrid({
			        			
			        			width:1116,
			        			height:250,
			        			url:'<%=path%>/main/get/skxbss',
			        	    	    queryParams : {
			        				 "cropid":cropid,
			        				 "serialno":lsh,
			        			    },
			        			rownumbers:true,
			        			selectOnCheck: true,
			        		    checkOnSelect: true,
			        			title:'',	
			        			columns:[[
			        			{field:'id',title:'序号',width:190,checkbox:true},
			                    {  
			                        field: 'consumeclass',  
			                        title: '消费大类',  //拥有远程数据库
			                        width: 75,  
			                        formatter: function(value) {  
			                            for (var i = 0; i < xiaofeishuju.length; i++) {  
			                                if (xiaofeishuju[i].consumeclass == value){ 
			                                	
			                                	return xiaofeishuju[i].consumeclass
			                                };  
			                            }  
			                            return value;  
			                        },  
			                        editor: {  
			                            type: 'combobox',  
			                            options: {  
			                                valueField: 'consumeclass',  
			                                textField: 'consumeclass',  
			                                data: xiaofeishuju,  
			                                required: true,
			                                onSelect:function(rowIndex, rowData){
			                          			
			                                	var row = $("#ttt").datagrid('getSelected');
			                                	var rindex = $("#ttt").datagrid('getRowIndex', row);	                   
			                                
			                                	var ed = $("#ttt").datagrid('getEditor', {
			                                        index: rindex,
			                                        field: 'consumeclass'
			                                    });
			                                	 var s = $(ed.target).combobox('getText');
			                                	
			                                	$.ajax({
			                        				type:"GET",
			                        		 		async: false,
			                        				url:'<%=path%>/main/get/localzixiaofei',
			                        				dateType:'json',
			                        				data:{"iname":s},
			                        				success:function(data){
			                        					
			                        					var result = eval('(' + data + ')');
			                        				
			                        					
			                        					var editor = $("#ttt").datagrid("getEditor",{index:rindex,field:'project'});
			                        					$(editor.target).combobox("loadData",result.data);
			                        			
			                        					}
			                        				});
			                                	}
			                            }  
			                        }  
			                    },
			                    {  
			                        field: 'project',  
			                        title: '项目',  
			                        width: 75,  
			                        formatter: function(value) {  
			                            for (var i = 0; i < xiaofeishuju.length; i++) {  
			                                if (xiaofeishuju[i].code == value){ 
			                                	
			                                	return xiaofeishuju[i].codename
			                                };  
			                            }  
			                            return value;  
			                        },  
			                        editor: {  
			                            type: 'combobox',  
			                            options: {  
			                                valueField: 'projecttype',  
			                                textField: 'projecttype',  
			                                data: xiaofeishuju,  
			                                required: true
			                            }  
			                        }  
			                    },
			                    {field:'subinfo',title:'项目明细',width:75,editor: { type: 'text', options: { required: true } }},
			                    {field:'operationDoctor',title:'手术医师',width:75,editor: { type: 'text', options: { required: true } }},
			                    {field:'secondDoctor',title:'配台医师',width:65,editor: { type: 'text', options: { required: true } }},
			                    {field:'unoperationDoctor',title:'非手术医师',width:75,editor: { type: 'text', options: { required: true } }},
			                    {field:'assistantDictor',title:'医师助手',width:65,editor: { type: 'text', options: { required: true } }},
			        	        {field:'price',title:'标价',width:55,editor: { type: 'validatebox', options: { required: true} }},
			        	        {field:'quantity',title:'数量',width:55,
			        	        	editor: { type: 'validatebox', options: { required: true,
			        	        							
			        	        		} 
			        	       		 }
			        	        },
			        	        {field:'discount',title:'折扣率',width:55,editor: { type: 'validatebox',options:{
			        	        	
			        	        }}},
			        	        {field:'amount',title:'优惠金额',width:65,editor: { type: 'validatebox'}},
			        	        {field:'priceAfterDiscount',title:'实际消费金额',width:85,editor: { type: 'numberbox',options:{
			        	        	precision:"2" ,max:"99999.99",size:"8" ,maxlength:"8"
			        	        }}},
			        	        {field:'fssbz',title:'非手术备注',width:75,editor: { type: 'text', options: { required: true } }},
			        	        {field:'remark',title:'备注',width:70,editor: { type: 'text', options: { required: true } }},	
			        	        {field:'action',title:'操作',width:90,align:'center',
			                        formatter:function(value,row,index){
			                            if (row.editing){
			                                var s = '<a onclick="saverow(this)">保存</a> ';
			                                var c = '<a onclick="cancelrow(this)">取消</a>';
			                                return s+c;
			                            } else {
			                                var e = '<a onclick="editrow(this)">编辑</a> ';
			                                var d = '<a onclick="deleterow(this)">删除</a>';
			                                return e+d;
			                            }
			                        }
			                    }
			        			          ]],
			        			  
			        			          
			        			          onBeforeEdit:function(index,row){
			        				            row.editing = true;
			        				            updateActions(index);
			        				        },
			        				        onAfterEdit:function(index,row){
			        				            row.editing = false;
			        				            updateActions(index);
			        				        },
			        				        onCancelEdit:function(index,row){
			        				            row.editing = false;
			        				            updateActions(index);
			        				        }
			        			 
			        		});	
			              	  
			        		
			        		
			        		var psj="";
			        		var fs="";
			        		var websj="";
			        		var scbsj="";
			        		var mzsj="";
			        		var other="";
			        		  
			        	    $('#tt1').datagrid({
			        	        rownumbers:true,
			        	        width:924,
			        	        height:250,
			        	        url:'<%=path%>/main/get/skxbb',

			        	    	 queryParams : {
			        				 "cropid":cropid,
			        				 "serialno":lsh 
			        			},
			        	        checkOnSelect: true,
			        	        columns:[[
			        	            {field:'id',title:'序号',width:60,checkbox: true},
			        	            {field:'consultationFied',title:'现场咨询',width:100,editor: { type: 'text', options: { required: true } }},
			        	            {field:'consultationTel',title:'电话咨询',width:100,editor: { type: 'text', options: { required: true }}},
			        	            {field:'consultationSite',title:'网络咨询',width:100,editor: { type: 'text', options: { required: true } }},
			        	            {field:'markingdepa',title:'市场部',width:100,editor: { type: 'text', options: { required: true } }},
			        	            {field:'outpatientNurse',title:'门诊护士',width:100,editor: { type: 'text', options: { required: true } }},
			        	            {field:'otherDepa',title:'其他部门人员',width:100,editor: { type: 'text', options: { required: true } }},
			        	            {field:'hydw',title:'会员单位',width:80,editor: { type: 'text', options: { required: true } }},
			        	            {field:'chuku',title:'出库单',width:80,editor: { type: 'text' }},
			        	            {field:'action',title:'操作',width:90,align:'center',
			        	                formatter:function(value,row,index){
			        	                    if (row.editing){
			        	                        var s = '<a  onclick="saverowb(this)">保存</a> ';
			        	                        var c = '<a  onclick="cancelrowb(this)">取消</a>';
			        	                        return s+c;
			        	                    } else {
			        	                        var e = '<a  onclick="editrowb(this)">编辑</a> ';
			        	                        var d = '<a  onclick="deleterowb(this)">删除</a>';
			        	                        return e+d;
			        	                    }
			        	                }
			        	            }
			        	        ]],
			        	        onBeforeEdit:function(index,row){
			        	            row.editing = true;
			        	            updateActionsb(index);
			        	        },
			        	        onAfterEdit:function(index,row){
			        	            row.editing = false;
			        	            updateActionsb(index);
			        	        },
			        	        onCancelEdit:function(index,row){
			        	            row.editing = false;
			        	            updateActionsb(index);
			        	        }
			        	    });
			        		
			        		
			        		var cs="";
			        		$.ajax({
			        			type:"GET",
			        	 		async: false,
			        			url:'<%=path%>/main/get/localsettles',
			        			dateType:'json',
			        			data:{"cropid":<%=session.getAttribute("cropid")%>},
			        			success:function(data){
			        				var result = eval('(' + data + ')');
			        				cs=result.data;
			        				}
			        		});
			        		
			        	    $('#tt2').datagrid({
			        	        rownumbers:true,
			        	        width:411,
			        	        height:140,
			        	        url:'<%=path%>/main/get/stinfo',
			        	    	 queryParams : {
			        				 "cropid":cropid,
			        				 "serialno":lsh
			        			},
			        	        checkOnSelect: true,
			        	        columns:[[
			        	           {field:'id',title:'序号',width:60,checkbox:true},
			        	 	       {  
			        	                field: 'settlement',  
			        	                title: '结算方式',  
			        	                width: 70,  	          
			        	                editor: {  
			        	                    type: 'combobox',  
			        	                    options: {  
			        	                        valueField: 'settlement',  
			        	                        textField: 'settlement',  
			        	                        data: cs,  
			        	                        required: true,
			        	                    }  
			        	                }  
			        	            }, 
			        	            {field:'mingxi',title:'明细',width:60,editor: { type: 'text', options: { required: true } }},
			        	            {field:'amount',title:'金额',width:60,editor: { type: 'numberbox', options:{required: true,
			            	        	precision:"2" ,max:"99999.99",size:"8" ,maxlength:"8"
			            	        } }},
			        	            {field:'tips',title:'结算备注',width:60,editor: { type: 'text', options: { required: true } }},
			        	            {field:'action',title:'操作',width:70,align:'center',
			        	                formatter:function(value,row,index){
			        	                    if (row.editing){
			        	                        var s = '<a  onclick="saverowc(this)">保存</a> ';
			        	                        var c = '<a  onclick="cancelrowc(this)">取消</a>';
			        	                        return s+c;
			        	                    } else {
			        	                        var e = '<a  onclick="editrowc(this)">编辑</a> ';
			        	                        var d = '<a  onclick="deleterowc(this)">删除</a>';
			        	                        return e+d;
			        	                    }
			        	                }
			        	            }
			        	        ]],
			        	        onBeforeEdit:function(index,row){
			        	            row.editing = true;
			        	            updateActionsc(index);
			        	        },
			        	        onAfterEdit:function(index,row){
			        	            row.editing = false;
			        	            updateActionsc(index);
			        	        },
			        	        onCancelEdit:function(index,row){
			        	            row.editing = false;
			        	            updateActionsc(index);
			        	        },
			        	        onEndEdit:function(rowIndex, rowData, changes){
			        		      
			        		        
			        		    }
			        	    });
			        	    
			        	    
			        	    //自定义1个combogrid编辑器
			        		 $.extend($.fn.datagrid.defaults.editors, {
			        		
			        			    combogrid: {			
			        			        init: function(container, options){			
			        			            var input = $('<input id="cc" type="text" class="datagrid-editable-input">').appendTo(container);
			        			           	
			        			            input.combogrid(options);		
			        			            return input;			
			        			        },
			        			        
			        			        destroy: function(target){			
			        			            $(target).combogrid('destroy');		
			        			        },
			        		
			        			        getValue: function(target){			
			        			            return $(target).combogrid('getValue');		
			        			        },
			        			
			        			        setValue: function(target, value){		
			        			            $(target).combogrid('setValue', value);			
			        			        },
			        			        setValues: function(target, values){		
			        			            $(target).combogrid('setValues', values);			
			        			        },
			        			
			        			        resize: function(target, width){		
			        			            $(target).combogrid('resize',width);			
			        			        }
			        			
			        			    }
			        			
			        			});   

			        		
			        		
			        		var es =[
			        	{

			        	"ystype": "1",
			        	"ysname": "应收"
			        	},
			        	{
			        		"ystype": "0",
			        		"ysname": "应付"
			        	}
			        	];
			        		
			        		var  gssj="";
			        				
			        		$('#tt3').datagrid({
			        			
			        			width:463,
			        			height:140,
			        			url:'<%=path%>/main/get/rminfo',
			        	    	 queryParams : {
			        				 "cropid":cropid,
			        				 "serialno":lsh 
			        			},

			        			rownumbers:true,
			        			selectOnCheck: true,
			        		    checkOnSelect: true,
			        			title:'',	
			        			columns:[[
			        			{field:'id',title:'序号',width:190,checkbox:true},
			        	         {  
			                       field: 'type',  
			                       title: '类型(其他应收应付)',  
			                       width: 130,  
			                  
			                       editor: {  
			                           type: 'combobox',  
			                           options: {  
			                               valueField: 'ysname',  
			                               textField: 'ysname',  
			                               data: es,  
			                               required: true,
			                               onSelect:function(rowIndex, rowData){
			        			                  
			                               	var row = $("#tt3").datagrid('getSelected');
			                               	var rindex = $("#tt3").datagrid('getRowIndex', row);
			                          
			                               	var ed1 = $("#tt3").datagrid('getEditor', {
			                                       index: rindex,
			                                       field: 'type'
			                                   });
			                          
			                               	  var s = $(ed1.target).combobox('getValue');
			                               
			                               	  //本地proinfo表
			                               	$.ajax({
			                       				type:"GET",
			                       		 		async: false,
			                       				url:'<%=path%>/rm/crp',
			                       				dateType:'json',
			                       				data:{"buytype":s,"cropid":<%=session.getAttribute("cropid")%>},
			                       				success:function(data){
			                       				
			                       				 var result = eval('(' + data + ')');	
			                       				
			                       				 var editor = $("#tt3").datagrid("getEditor",{index:rindex,field:'corp'});
			                       				$(editor.target).combobox("loadData",result.data); 
			                       			
			                       					}
			                       				});
			                               	}
			                           }  
			                       }  
			                   },
			                   {  
			                       field: 'corp',  
			                       title: '公司',  
			                       width: 70,  
			                      
			                       editor: {  
			                           type: 'combobox',  
			                           options: {  
			                               valueField: 'corp',  
			                               textField: 'corp',                         
			                               required: true,
			                               
			                               onSelect:function(rowIndex, rowData){
			        			                  
			                               	var row = $("#tt3").datagrid('getSelected');
			                               	var rindex = $("#tt3").datagrid('getRowIndex', row);
			                          
			                               	var ed = $("#tt3").datagrid('getEditor', {
			                                       index: rindex,
			                                       field: 'corp'
			                                   });
			                               	 gssj="";
			                               	 gssj = $(ed.target).combobox('getText');
			                           		
			                               	}
			                           } 
			                   
			                       }  
			                   },
			                   //{field:'productid',title:'公司',name:'productId',width:100}, 
			                   	{field:'amount',title:'金额',width:100,editor: { type: 'numberbox', options:{required: true,
			           	        	precision:"2" ,max:"99999.99",size:"8" ,maxlength:"8"
			           	        } }},
			        	            {field:'action',title:'操作',width:70,align:'center',
			        	                formatter:function(value,row,index){
			        	                    if (row.editing){
			        	                        var s = '<a  onclick="saverowd(this)">保存</a> ';
			        	                        var c = '<a  onclick="cancelrowd(this)">取消</a>';
			        	                        return s+c;
			        	                    } else {
			        	                        var e = '<a  onclick="editrowd(this)">编辑</a> ';
			        	                        var d = '<a  onclick="deleterowd(this)">删除</a>';
			        	                        return e+d;
			        	                    }
			        	                }
			        	            }
			        	        ]],
			        	        onBeforeEdit:function(index,row){
			        	        	
			        	            row.editing = true;
			        	            updateActionsd(index);
			        	        },
			        	        onAfterEdit:function(index,row){
			        	            row.editing = false;
			        	            updateActionsd(index);
			        	            
			        	        },
			        	        onCancelEdit:function(index,row){
			        	        	
			        	            row.editing = false;
			        	            updateActionsd(index);

			        	        },
			        	        onEndEdit:function(rowIndex, rowData, changes){
			        	        /* 	var fs= $('#cc').combogrid('getValues'); */
			        	        	
			        	        	/* rowData.productid = gssj; */
			        	        	
			        	        }
			        	    });

			                }
			                }, '-',
			                { text: '审核',iconCls: 'icon-redo', handler: function () {
			    				
			                	var s=$("#tt").datagrid('getChecked');
			   					 $.messager.confirm('','确定通过吗?',function(r){
			   					 if (r){
			   						    var row = $('#tt').datagrid('getSelected');
			   				 		    var lsh =row.serialno;
			   				       	    var cropid=<%=session.getAttribute("cropid")%>
			   				       	    
			   				       	    $.ajax({
			   				       	    	 type: "GET",
			   				       	    	 url: '<%=path%>/main/sh',
			   				       	     	 data:{
			   		 							 "corpid":cropid,
			   		 							 "isno":lsh
			   		 						
			   		 						},
			   		 						async : false,
			   		 						success : function(data) {
			   		 							console.log(data);
			   		 							var data = eval('(' + data + ')');
			   		 							var num = data.data;
			   		 							console.log(num);
			   		 							if(num==1){
			   		 								$.messager.alert("","审核成功");  
			   		 								 $('#tt').datagrid('reload',{
			   		 									 "cropid":<%=session.getAttribute("cropid")%>
			   		 								 });

			   		 							}else{
			   		 								$.messager.alert("","审核失败");  
			   		 							}
			   		 							
			   		 						}
			   				       	    })
			   					 }
			   				 });
			                }
			                }, '-',
			                { text: '删除',  handler: function () {
			                	
			        			var s=$("#tt").datagrid('getChecked');
			        			var rowIndex=$('#tt').datagrid('getRowIndex',$('#tt').datagrid('getSelected'));
			    			    $.messager.confirm('','确定删除吗?',function(r){
			    			        if (r){
			    			        	var row = $('#tt').datagrid('getSelected');
			    			 		    var lsh =row.serialno;
			    			       	    var cropid=<%=session.getAttribute("cropid")%>
			    			      		 
			    			      		  $.ajax({
			    			 		           type: "GET",
			    			 		           url: '<%=path%>/main/sc',
			    			 				   data:{
			    			 							 "corpid":cropid,
			    			 							 "isno":lsh
			    			 						},
			    			 							async : false,
			    			 							success : function(data) {
			    			 								console.log(data);
			    			 								var data = eval('(' + data + ')');
			    			 								
			    			 							    var num = data.status;
			    			 							    if (num == 0) {				   
			    			 							    	$.messager.alert("","删除成功");  
			    			 							    $('#tt').datagrid('deleteRow', rowIndex);
			    			 							    $('#tt').datagrid('reload',{
					   		 									 "cropid":<%=session.getAttribute("cropid")%>
					   		 								 });
			    			 								}
			    			 							    if(num==2){
			    			 							    	$.messager.alert("","已生成凭证不能删除!");
			    			 							    }
			    			 							    if(num==3){
			    			 							    	$.messager.alert("","已审核不能删除!");			
			    			 							    }
			    			 							    if(num==4){
			    			 							    	$.messager.alert("","凭证已生成并且已经通过审核，不能删除!");	
			    			 							    }

			    			 							}
			    			 						}); 
			    			        	
			    			          
			    			        }
			    			    });
			                }
			                }, '-'],
				columns:[[	         
				{field:'date',title:'单据日期',width:100},
				{field:'no',title:'单据编号',width:100},
			 	{field:'serialno',title:'流水号',width:100}, 
				{field:'customer',title:'顾客名称',width:75},
				{field:'zhuangtai',title:'是否生成凭证',width:100},
				{field:'shenhezhuangtai',title:'审核状态',width:100},
				{field:'cash',title:'现金',width:60},
				{field:'posshuaka',title:'刷卡POS',width:60},
				{field:'dianhui',title:'电汇',width:60},
				{field:'huaka',title:'划卡',width:60},
				{field:'yajintrans',title:'押金转入',width:60},
				{field:'remark',title:'备注',width:60},
				          ]],
				  onLoadSuccess:function() {
					 
						var rows = $('#tt').datagrid('getRows')//获取当前的数据行
						console.log(rows+"!");
			            var csum= 0;
			            var psum=0;
			            var dsum=0;
			            var hsum=0;
			            var ysum=0;
			            for (var i = 0; i < rows.length; i++) {
			            	csum += Number(rows[i]['cash']);
			            	psum += Number(rows[i]['posshuaka']);
			            	dsum += Number(rows[i]['dianhui']);
			            	hsum += Number(rows[i]['huaka']);
			            	ysum += Number(rows[i]['yajintrans']);
			            }
					  
					  
			           $('#tt').datagrid('appendRow', {
			        	   date:'<b>统计</b>',cash:csum,posshuaka:psum,dianhui:dsum,huaka:hsum,yajintrans:ysum });
				          }
			});	
		
		
	    function compute(colName) {
            var rows = $('#tt').datagrid('getRows');
            var total = 0;
            for (var i = 0; i < rows.length; i++) {
                total += parseFloat(rows[i][colName]);
            }
            return total;
        }
		  
		    var pager=$('#tt').datagrid('getPager');
	            pager.pagination({
		        pageSize:10,
		        pageNumber:1,
		        pageList :[10,20,30],// 可以设置每页记录条数的列表
		        beforePageText: '第',//页数文本框前显示的汉字  
	            afterPageText: '页    共 {pages} 页',  
	            displayMsg: '共 {total} 条记录',
	      })
	           
	       	
		});

	
		function updateActionsd(index){
		    $('#tt3').datagrid('updateRow',{
		        index: index,
		        row:{}
		    });
		}
		
		function getRowIndexd(target){
		    var tr = $(target).closest('tr.datagrid-row');
		    return parseInt(tr.attr('datagrid-row-index'));
		}
		function editrowd(target){
		    $('#tt3').datagrid('beginEdit', getRowIndexd(target));
		}
		function deleterowd(target){
		    $.messager.confirm('','确定删除?',function(r){
		        if (r){
		            $('#tt3').datagrid('deleteRow', getRowIndexd(target));
		        }
		    });
		}
		function saverowd(target){
		    $('#tt3').datagrid('endEdit', getRowIndexd(target));  
		}
		function cancelrowd(target){
		    $('#tt3').datagrid('cancelEdit', getRowIndexb(target));
		}
		function insertd(){
	
			$('#tt3').datagrid('appendRow', {
			
			});
			
			var index = $("#tt3").datagrid('getRows').length-1;
			
			if(index==0){
				
			}else{
				$("#tt3").datagrid("unselectRow",index-1);
			}
			
			$('#tt3').datagrid('selectRow',index);
			$('#tt3').datagrid('beginEdit',index);
		}
		//==================================================================================
		
		
		function updateActionsc(index){
		    $('#tt2').datagrid('updateRow',{
		        index: index,
		        row:{}
		    });
		}
		
		function getRowIndexc(target){
		    var tr = $(target).closest('tr.datagrid-row');
		    return parseInt(tr.attr('datagrid-row-index'));
		}
		function editrowc(target){
		    $('#tt2').datagrid('beginEdit', getRowIndexb(target));
		}
		function deleterowc(target){
		    $.messager.confirm('','确定删除?',function(r){
		        if (r){
		            $('#tt2').datagrid('deleteRow', getRowIndexb(target));
		        }
		    });
		}
		function saverowc(target){
		    $('#tt2').datagrid('endEdit', getRowIndexb(target));
		}
		function cancelrowc(target){
		    $('#tt2').datagrid('cancelEdit', getRowIndexb(target));
		}
		function insertC(){
		
			$('#tt2').datagrid('appendRow', {
				
			});
			var index = $("#tt2").datagrid('getRows').length-1;
			
			if(index==0){
				
			}else{
				$("#tt2").datagrid("unselectRow",index-1);
			}

			$('#tt2').datagrid('selectRow',index);
			$('#tt2').datagrid('beginEdit',index);
		}
	//==================================================================================	
		function updateActionsb(index){
		    $('#tt1').datagrid('updateRow',{
		        index: index,
		        row:{}
		    });
		}
		
		function getRowIndexb(target){
		    var tr = $(target).closest('tr.datagrid-row');
		    return parseInt(tr.attr('datagrid-row-index'));
		}
		function editrowb(target){
		    $('#tt1').datagrid('beginEdit', getRowIndexb(target));
		}
		function deleterowb(target){
		    $.messager.confirm('','删除确定?',function(r){
		        if (r){
		            $('#tt1').datagrid('deleteRow', getRowIndexb(target));
		        }
		    });
		}
		function saverowb(target){
		    $('#tt1').datagrid('endEdit', getRowIndexb(target));
		}
		function cancelrowb(target){
		    $('#tt1').datagrid('cancelEdit', getRowIndexb(target));
		}
		function insertb(){


			$('#tt1').datagrid('appendRow', {
				
				
			});
			var index = $("#tt1").datagrid('getRows').length-1;
			
			if(index==0){
				
			}else{
				$("#tt1").datagrid("unselectRow",index-1);
			}
			
			$('#tt1').datagrid('selectRow',index);

			$('#tt1').datagrid('beginEdit',index);	
		}
		
		

		
	//=================================================================================	
		
		function updateActions(index){
		    $('#ttt').datagrid('updateRow',{
		        index: index,
		        row:{}
		    });
		}
		function getRowIndex(target){
		    var tr = $(target).closest('tr.datagrid-row');
		    return parseInt(tr.attr('datagrid-row-index'));
		}
		function saverow(target){
		    $('#ttt').datagrid('endEdit', getRowIndex(target));
		}
		function cancelrow(target){
		    $('#ttt').datagrid('cancelEdit', getRowIndex(target));
		}
		function deleterow(target){
		    $.messager.confirm('','确定删除？',function(r){
		        if (r){
		            $('#ttt').datagrid('deleteRow', getRowIndex(target));
		        }
		    });
		}
		function editrow(target){
		    $('#ttt').datagrid('beginEdit', getRowIndex(target));
			
		    var row = $('#ttt').datagrid('getSelected');
		    var index = $('#ttt').datagrid('getRowIndex', row);
		    setEditing(index);  
		}
		function insert(){
		
			$('#ttt').datagrid('appendRow', {
			
			});
			var index = $("#ttt").datagrid('getRows').length-1;
			
			if(index==0){
				
			}else{
				$("#ttt").datagrid("unselectRow",index-1);
			}
			
			$('#ttt').datagrid('selectRow',index);
			
			$('#ttt').datagrid('beginEdit',index);
		     
        	  setEditing(index);    
		}
		function setEditing(rowIndex){   
			
			var arr=[];
			
			var editors = $('#ttt').datagrid('getEditors', rowIndex);   
		 
			var priceEditor = editors[7];   //价格
		    var amountEditor = editors[8];   //数量
		    var zkEditor = editors[9];		//折扣率
	
		    var yhjine = editors[10];		//优惠金额
		    var zhEditor =editors[11];		//折后金额
		    priceEditor.target.bind('change', function(){   
		        calculate();   
		    });   
		    amountEditor.target.bind('change', function(){   
		        calculate();   
		    });
		    zkEditor.target.bind('change', function(){   
		        calculate();   
		    }); 
		    yhjine.target.bind('change', function(){   
		        calculate();   
		    }); 
		    
		    function calculate(){  
		    	
		    	var price=priceEditor.target.val();//价格
		        var amount=amountEditor.target.val();//数量
		        var zkl =zkEditor.target.val();//折扣率
		        var yh = yhjine.target.val();//优惠金额
		        
		    	
		        if(zkl!=0&&yh!=0){
		        	alert("折扣率和优惠金额只能输一项");
		        }else{
		        
		        if(zkl==0&&yh==0){
		    		var cost = price* amount;
		    		$(zhEditor.target).numberbox('setValue',cost);
		    		$(yhjine.target).val(0);
		    	}else{
		    	
		    	   if(zkl!=0&&yh==0){
		    		var cost = price* amount*zkl;
		  
					$(zhEditor.target).numberbox('setValue',cost);
					
		    	   }
					if(yh!=0&&zkl==0){
				
			    		var cost = price* amount-yh;
			    						    			
			    		$(zhEditor.target).numberbox('setValue',cost);
			    	
						}				    	   
		    		}
		    	}   
		    }
		    
		  
		    
		    
		    
		} 
      	//$(function (){
      		
      		//$("#chakanbtn").click(function(){
      			//$(".accountbox").css("display","block");
      			
      		//})
      	//})
	</script>
	<script>
	function baocun(){
		var dd = document.getElementById('dd').value;
		var danju = document.getElementById('danju').value;
		var lsh = document.getElementById('lsh').value;
		var fph =  document.getElementById('fph').value;
		
		console.log(dd+","+danju+","+lsh+","+fph);
	

		var name = document.getElementById('gkxm').value;
		var phone = document.getElementById('sjh').value;
		var banka = document.getElementById("bksj").value;
		var youhuis = document.getElementById('yhhd').value;
		
		var yuyue = document.getElementById("yyjsj").value;
		
		var fptt = document.getElementById('fptt').value;
		console.log(name+","+","+phone+","+banka+","+youhuis+","+yuyue+","+","+fptt);
	
		

		 //获取tt表里面的数据
		 var g21="";
		 var g22="";
		 var g23="";
		 var g24="";
		 var g25="";
		 var g26="";
		 var g27="";
		 var g28="";
		 var g29="";
		 var g210="";
		 var g211="";
		 var g212="";
		 var g214="";
			var checkedItems = $('#ttt').datagrid('getChecked');
			
			var  price=0;
			var s0 ="";
			var s1 ="";
			var s2 ="";
			var s3 ="";
			var s4 ="";
			var s5 ="";
			var s6 ="";
			var s7 ="";
			var s8 ="";
			var s9 ="";
			var s10 ="";
			var s11 ="";
			var s12 ="";
			var s13 ="";
			var s14 ="";
			
			var guodu0="";
			var guodu1="";
			var guodu2="";
			var guodu3="";
			var guodu4="";
			var guodu5="";
			var guodu6="";
			var guodu7="";
			var guodu8="";
			var guodu11="";
			var guodu111="";
			console.log(checkedItems);
			$.each(checkedItems, function(index, item){
				
				price+=Number(item.priceAfterDiscount);
				
				s0+=s0==""?item.id:","+item.id;
				s1+=s1==""?item.consumeclass:","+item.consumeclass;
				s2+=s2==""?item.project:","+item.project;
				
				if(item.subinfo==""){
					guodu1="1"
				}else{
					guodu1=item.subinfo
				}
				s3+=guodu1+","
				
				
				
				if(item.operationDoctor==""){
					guodu2="1"
				}else{
					guodu2=item.operationDoctor
				}
				s4+=guodu2+","
				
				
				if(item.secondDoctor==""){
					guodu3="1"
				}else{
					guodu3=item.secondDoctor
				}
				s5+=guodu3+","
				
				
				if(item.unoperationDoctor==""){
					guodu4="1"
				}else{
					guodu4=item.unoperationDoctor
				}
				s6+=guodu4+","
				
				
				if(item.assistantDictor==""){
					guodu5="1"
				}else{
					guodu5=item.assistantDictor
				}
				s7+=guodu5+","
				
			
				s8+=s8==""?item.price:","+item.price;
				s9+=s9==""?item.quantity:","+item.quantity;
			
	

				if(item.discount==""){
					guodu6="1"
				}else{
					guodu6=item.discount
				}
				s10+=guodu6+","
				
				if(item.priceAfterDiscount==""){
					guodu7="1"
				}else{
					guodu7=item.priceAfterDiscount
				}
				s11+=guodu7+","
				
				
				if(item.remark==""){
					guodu8="1"
				}else{
					guodu8=item.remark
				}
				s12+=guodu8+","
				
				
				if(item.amount==""){
					guodu11="1"
				}else{
					guodu11=item.amount
				}
				s13+=guodu11+","
				
				
				if(item.fssbz==""||item.fssbz==null){
					guodu111="1"
				}else{
					guodu111=item.fssbz
				}
				s14+=guodu111+","
				});
			
			
			
			
			g20=s0;
			g21=s1;
			g22=s2;
			g23=s3;
			g24=s4;
			g25=s5;
			g26=s6;
			g27=s7;
			g28=s8;
			g29=s9;
			g210=s10;
			g211=s11;
			g212=s12;
			g213=s13;
			g214=s14;
			console.log(g20+"||"+g21+"||"+g22+"||"+g23+"||"+g24+"||"+g25+"||"+g26+"||"+g27+"||"+g28+"||"+g29+"||"+g210+"||"+g211+"||"+g212+"||"+g213+"$$$$$$$"+"||"+g214);
	
		
			console.log(price);
			
			var g1="";
			var g2="";
			var g3="";
			var g4="";
			var g5="";
			var g6="";
			var hy="";
			var chuku="";
			var checkedItems = $('#tt1').datagrid('getChecked');
			if(checkedItems[0]==undefined){
				g1="1,";
				g2="1,";
				g3="1,";
				g4="1,";
				g5="1,";
				g6="1,";
				hy="1,";
				chuku="1,";
			}else{
				var ss1 ="";
				var ss2 ="";
				var ss3 ="";
				var ss4 ="";
				var ss5 ="";
				var ss6 ="";
				var ss7 ="";
				var sss8="";
				
				var guodus1="";
				var guodus2="";
				var guodus3="";
				var guodus4="";
				var guodus5="";
				var guodus6="";
				var guodus7="";
				var guoduss8="";
				
				$.each(checkedItems, function(index, item){
					
					if(item.consultationFied==""){
						guodus1="1";
					}else{
						guodus1=item.consultationFied;
					}
					ss1+=guodus1+",";
				
					if(item.consultationTel==""){
						guodus2="1";
					}else{
						guodus2=item.consultationTel;
					}
					ss2+=guodus2+",";
					
					
					if(item.consultationSite==""){
						guodus3="1";
					}else{
						guodus3=item.consultationSite;
					}
					ss3+=guodus3+",";
					

					if(item.markingdepa==""){
						guodus4="1";
					}else{
						guodus4=item.markingdepa;
					}
					ss4+=guodus4+",";
					
					if(item.outpatientNurse==""){
						guodus5="1";
					}else{
						guodus5=item.outpatientNurse;
					}
					ss5+=guodus5+",";
					
					if(item.otherDepa==""){
						guodus6="1";
					}else{
						guodus6=item.otherDepa;
					}
					ss6+=guodus6+",";
					
					if(item.hydw==""){
						guodus7="1";
					}else{
						guodus7=item.hydw;
					}
					ss7+=guodus7+",";
			
					if(item.chuku==""){
						guoduss8="1";
						}else{
						guoduss8=item.chuku;
							}
						sss8+=guoduss8+",";		
				});
				
				g1=ss1;
				g2=ss2;
				g3=ss3;
				g4=ss4;
				g5=ss5;
				g6=ss6;
				hy=ss7;
				chuku=sss8;
				console.log(g1+"!"+g2+"!"+g3+"!"+g4+"!"+g5+"!"+g6+"!"+hy+"!"+chuku);	
			}		
		
		
		//获取tt2表格里面的数据
		var g30="";
		var g31="";
		var g32="";
		var g33="";
		var g34="";
		
		
			var checkedItems = $('#tt2').datagrid('getChecked');
			var jine=0;
			if(checkedItems[0]==undefined){
				jine=0;
				g31="1,";
				g32="1,";
				g33="1,";
				g34="1,";
				
			
			}else{
			
			var s0 ="";
			var s1 ="";
			var s2 ="";
			var s3 ="";
			var s4 ="";
			
			
			var guodu9="";
			var guodu10="";
			$.each(checkedItems, function(index, item){
				
				
				jine+=Number(item.amount);
				
				if(item.settlement=="服务项目"){
					jine-=Number(item.amount);
				}
				
				
		
				s0+=s0==""?item.id:","+item.id;	
				s1+=s1==""?item.settlement:","+item.settlement;
			
				
				
				if(item.mingxi==""){
					guodu9="1"
				}else{
					guodu9=item.mingxi
				}
				s2+=guodu9+","
				
			
			
				s3+=s3==""?item.amount:","+item.amount;
			
		
				if(item.tips==""){
					guodu10="1"
				}else{
					guodu10=item.tips
				}
				s4+=guodu10+","
		
			});
			console.log(jine);
				g30=s0;
				g31=s1;
				g32=s2;
				g33=s3;
				g34=s4;
			}
		console.log(g30+"$$");
		
				//获取tt3表里面的数据
			     var g40="";
				 var g41="";
				 var g42="";
				 var g43="";
		
					var checkedItems = $('#tt3').datagrid('getChecked');
			
				
					
					var jines1=0;//应收金额
					var jines0=0;//应付金额
					if(checkedItems[0]==undefined){
						jines1=0;//应收金额
					    jines0=0;//应付金额
						g41="1,";
						g42="1,";
						g43="1,";
					}else{
					var s1="";
					var s2="";
					var s3="";
					
					var guduo12="";
					var guduo13="";
					var guduo14="";
					
	

					$.each(checkedItems, function(index, item){
						
					
						g40+=g40==""?item.id:","+item.id;	
						
						 if(item.type=="应付"){
							
							 jines0+=Number(item.amount);
							
						}
						if(item.type=="应收"){
							 jines1+=Number(item.amount);
						} 
						
						if(item.type==""){
							guodu11="1,"
						}else{
							guodu11=item.type
						}
						s1+=guodu11+","
						
						if(item.corp==""){
							guodu12="1,"
						}else{
							guodu12=item.corp
						}
						s2+=guodu12+","
					
						
						if(item.amount==""){
							guodu13="1,"
						}else{
							guodu13=item.amount
						}
						s3+=guodu13+","
								
				
					});
					
					g41=s1;
					g42=s2;
					g43=s3;
				
		
					}
		console.log(g31+"||"+g32+"||"+g33+"||"+g34);
		console.log(g41+"||"+g42+"||"+g43+"||");
		
	
		
 		 if(dd==null||dd==""||name==null||name==""){
			
			alert("请完善数据!");
		}else{
			
			if(g31.indexOf("服务项目") >=0 ) {
		   	 	  $.ajax({
						type:"GET",
				    	async: false,
				   	 	url:"<%=path %>/lbs/update/billmain",
				   		data :{"lsh":lsh,"cropid":<%=session.getAttribute("cropid")%>,"dd":dd,"danju":danju,"lsh":lsh,"fph":fph,"name":name,"phone":phone,"banka":banka,"youhui":youhuis,"yuyue":yuyue,"fptt":fptt,"g1":g1,"g2":g2,"g3":g3,"g4":g4,"g5":g5,"g6":g6,"hy":hy,"chuku":chuku,"g20":g20,"g21":g21,"g22":g22,"g23":g23,"g24":g24,"g25":g25,"g26":g26,"g27":g27,"g28":g28,"g29":g29,"g210":g210,"g211":g211,"g212":g212,"g213":g213,"g214":g214,"g30":g30,"g31":g31,"g32":g32,"g33":g33,"g34":g34,"g40":g40,"g41":g41,"g42":g42,"g43":g43},
				   		dataType: "json",
				    	success:function(data){
	
				    		var status = data.data;
				    		if(status=='2'){
				    			alert("凭证已生成不能修改!");
				    			}
							if(status=='1'){
				   				alert("修改失败!");
				   				}
							if(status=="0"){
				   				alert("修改成功!");
								$('#tt').datagrid('reload',{
			   		 				 "cropid":<%=session.getAttribute("cropid")%>
			   		 								 });
				   			}
							if(status=="3"){
								alert("已审核不能修改!");
							}
							if(status=="4"){
								alert("凭证已生成并且已经通过审核，不能修改!");
							}
					    }
				   			
						}); 
			}else{
			
			if(price+jines0==jine+jines1){								
    	 	  $.ajax({
						type:"GET",
				    	async: false,
				   	 	url:"<%=path %>/lbs/update/billmain",
				   		data :{"lsh":lsh,"cropid":<%=session.getAttribute("cropid")%>,"dd":dd,"danju":danju,"lsh":lsh,"fph":fph,"name":name,"phone":phone,"banka":banka,"youhui":youhuis,"yuyue":yuyue,"chuku":chuku,"fptt":fptt,"g1":g1,"g2":g2,"g3":g3,"g4":g4,"g5":g5,"g6":g6,"hy":hy,"g20":g20,"g21":g21,"g22":g22,"g23":g23,"g24":g24,"g25":g25,"g26":g26,"g27":g27,"g28":g28,"g29":g29,"g210":g210,"g211":g211,"g212":g212,"g213":g213,"g214":g214,"g30":g30,"g31":g31,"g32":g32,"g33":g33,"g34":g34,"g40":g40,"g41":g41,"g42":g42,"g43":g43},
				   		dataType: "json",
				    	success:function(data){
	
				    		var status = data.data;
				    		if(status=='2'){
				    			alert("凭证已生成不能修改!");
				    			}
							if(status=='1'){
				   				alert("修改失败!");
				   				}
							if(status=="0"){
				   				alert("修改成功!");
								$('#tt').datagrid('reload',{
			   		 				 "cropid":<%=session.getAttribute("cropid")%>
			   		 								 });
				   			}
							if(status=="3"){
								alert("已审核不能修改!");
							}
							if(status=="4"){
								alert("凭证已生成并且已经通过审核，不能修改!");
							}
					    }
				   			
						});   
  	 	  
			}else{
				alert("价格不平，请重新计算");
				}
			}
		}  
				
	}
	</script>
<title>Insert title here</title>
<style>
		#d1{
		text-align:center;
		margin-top: 50px;
	}
		#d2{
		margin-left:1150px;
	}
		#d3{
	width: 1100px;
	margin: 45px auto;
	}
	#ddd1{
		width:100px;
		margin-left: 1110px;
	}
	#tt1s{
		margin-left:96px;
	}
</style>
</head>
<body>
	<div id="d2">	
				
	</div>
			
	
	<div id="d1"><h2>收款单列表</h2></div>
	
	
	
		<div id="d3">
				日期:<input id="riqis" type="text" class="easyui-datebox"/>
				<span><a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="chaxv()">
				<span class="l-btn-left">
					<span class="l-btn-text">查询</span>
				</span>
			</a></span>
				<table id="tt"></table>
						
		<table id="d4"></table>		
		</div>
		<div class="accountbox" style="display: none;position: absolute;top:0;left:50px;">

	<div id="ddd1">

			<span><a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="hidebtn()">
				<span class="l-btn-left">
					<span class="l-btn-text">关闭</span>
				</span>
			</a></span>
			<span><a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="baocun()">
				<span class="l-btn-left">
					<span class="l-btn-text">保存</span>
				</span>
			</a></span>
			
	</div>

<div class="dateof">
<ul>
<li><label>日期 <span style="color:red">*</span></label><input id="dd" type="text"/></li>
<li><label>单据号</label><input id="danju" type="text" /></li>
<li><label>流水号</label><input id="lsh" type="text" /></li>
<li><label>发票号</label><input id="fph" type="text" /></li>
</ul>
</div>
<h3>收款单</h3>
<div class="customerName wrapbored">
 <ul>
  <li><label>顾客姓名</label><input id="gkxm" type="text" />
				
				
</li>
  <li><label>手机号码</label><input type="text" id="sjh"/></li>
  <li><label>办卡时间</label><input id="bksj" type="text" ></li>
  <li><label>优惠活动</label><input type="text" id="yhhd" /></li>

  <li><label>预约金时间</label><input  type="text" id="yyjsj"/></li>
  <li><label>出库单</label><input type="text" id="ckd" value=""/></li>
  <li><label>发票抬头</label><input type="text" id="fptt" /></li>
 </ul>
</div>
<div class="scenebox1 wrapbored">
		<div style="margin-left:0px" id="dd1">
			<span><a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="insert()">
				<span class="l-btn-left">
					<span class="l-btn-text">新增</span>
				</span>
			</a></span>
		</div>
		<table id="ttt">
			
		</table>
</div>
<div class="scenebox2 wrapbored">

	<div id="tt1s">
	
		<div style="margin-left:0px" id="dd1">
		<span>	<a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="insertb()">
				<span class="l-btn-left">
					<span class="l-btn-text">新增</span>
				</span>
			</a>
		</span>

	</div>
	<table id="tt1">
						
	</table>
	</div>	
</div>


<div class="wrapbored">
	<div id="div1">
	 	<div style="margin-left:0px" id="">
				<span><a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="insertC()">
					<span class="l-btn-left">
						<span class="l-btn-text">新增</span>
					</span>
				</a></span>
					
		</div>
		<table id="tt2">
							
		</table>
	</div>
	
	<div id="div2">
		<div style="margin-left:0px" id="">
				<span><a href="javascript:void(0)" class="easyui-linkbutton l-btn l-btn-small" onclick="insertd()">
					<span class="l-btn-left">
						<span class="l-btn-text">新增</span>
					</span>
				</a></span>
			
		</div>

		<table id="tt3">
							
		</table>
	</div>
</div>

</div>

		
</body>
</html>